//
//  CollectionViewCelltwo.m
//  BAOASystem
//
//  Created by michael on 2018/1/26.
//  Copyright © 2018年 czd. All rights reserved.
//

#import "CollectionViewCelltwo.h"

@implementation CollectionViewCelltwo

- (void)awakeFromNib {
    [super awakeFromNib];
    _leftbutton.hidden = YES;
    _midbutton.hidden = YES;
    _rightbutton.hidden = YES;
    // Initialization code
}


- (void)layoutSubviews{

[super layoutSubviews];
_titlelabel.text = _dic[@"title"];

NSArray * array = _dic[@"pdimglist"];
if (array.count==1) {
   _midbutton.hidden = NO;
[_midbutton sd_setImageWithURL:[NSURL URLWithString:array[0][@"fileurl"]] forState:UIControlStateNormal];

}else if (array.count==2) {
   _midbutton.hidden = NO;
[_midbutton sd_setImageWithURL:[NSURL URLWithString:array[0][@"fileurl"]] forState:UIControlStateNormal];

   _leftbutton.hidden = NO;
[_leftbutton sd_setImageWithURL:[NSURL URLWithString:array[1][@"fileurl"]] forState:UIControlStateNormal];

}else{
   _midbutton.hidden = NO;
[_midbutton sd_setImageWithURL:[NSURL URLWithString:array[0][@"fileurl"]] forState:UIControlStateNormal];

   _leftbutton.hidden = NO;
[_leftbutton sd_setImageWithURL:[NSURL URLWithString:array[1][@"fileurl"]] forState:UIControlStateNormal];
   _rightbutton.hidden = NO;
[_rightbutton sd_setImageWithURL:[NSURL URLWithString:array[2][@"fileurl"]] forState:UIControlStateNormal];

}


}
- (IBAction)leftaction:(id)sender {
NSString*ipid = _dic[@"id"];
shangpinxqViewController *vc = [[shangpinxqViewController alloc]init];
vc.pdid = ipid;
vc.hidesBottomBarWhenPushed = YES;
[self.ViewController.navigationController pushViewController:vc animated:YES];

}

- (IBAction)midaction:(id)sender {
NSString*ipid = _dic[@"id"];
shangpinxqViewController *vc = [[shangpinxqViewController alloc]init];
vc.pdid = ipid;
vc.hidesBottomBarWhenPushed = YES;
[self.ViewController.navigationController pushViewController:vc animated:YES];

}

- (IBAction)rightaction:(id)sender {
NSString*ipid = _dic[@"id"];
shangpinxqViewController *vc = [[shangpinxqViewController alloc]init];
vc.pdid = ipid;
vc.hidesBottomBarWhenPushed = YES;
[self.ViewController.navigationController pushViewController:vc animated:YES];

}
@end
